<template>
	<view>
		<view class="">
			<view class="m-h1" style="text-align: center;">
				清单详情
			</view>
			<view class="" @tap="toBack()">
				<image class="nav-margin-back-img" src="../../static/back.png" mode="widthFix"></image>
			</view>
		</view>	
		
		<view class="nav-margin-top">
			<view class="content " style="padding-bottom: 10rpx;">
				<view class="o-4-font-2">
					<view class="">
						沙葛小学一期项目需求清单
					</view>
					<view class="">
						<text class="o-4-font-3" style="margin-right: 20rpx;">自建</text>
						<text class="o-4-font-4">2021-01-12 13:09</text>
					</view>
					<view class="" style="display: flex;justify-content: space-between;">
						<view class="o-5-font-1" style="padding-top: 20rpx;">
							2个商品
						</view>
						<view v-if="isSet" @click="isSet = false" class="o-5-set-btn">
							<text style="position: relative;top: 10rpx;">交付设置</text>
						</view>
						<view v-if="!isSet" @click="isSet = true" class="o-5-set-btn">
							<text style="position: relative;top: 10rpx;">完成</text>
						</view>
					</view>
				</view>
			</view>
			<view class="o-bg-1"></view>
			
			<view class="content">
				<view class="" style="display: flex;margin-top: 20rpx;">
					
					<view  v-if="isCheck1" class="" style="display: flex;align-items: center;">
						<image @tap="isCheck1=!isCheck1" style="width: 48rpx;height: 48rpx;" src="../../static/check-1.png" mode="widthFix"></image>
					</view>
					
					<view  v-if="!isCheck1" class="" style="display: flex;align-items: center;">
						<image @tap="isCheck1=!isCheck1" style="width: 48rpx;height: 48rpx;" src="../../static/none.png" mode="widthFix"></image>
					</view>
					
					<view class="" style="margin: 0 8rpx;">
						<image style="width: 248rpx;height: 248rpx;" src="../../static/pic.png" mode="widthFix"></image>
					</view>
					<view class="">
						<view class="o-5-font-1">
							外墙保温砌块 
						</view>
						<view class="o-5-font-1">
							规格(LxBxH)：600x200x250 
						</view>
						<view class="o-5-font-1">
							等级:B05A3.5   平面
						</view>
						<view class="">
							<text class="o-5-font-2">3-5天</text>
							<text class="o-5-font-2">40m³起订</text>
							<text class="o-5-font-2">70%定金</text>
						</view>
						<view class="" style="display: flex;justify-content: space-between;margin-top: 60rpx;">
							<view class="">
								<text class="o-5-font-3">¥89.0</text>
								<text class="o-5-font-4">/m³</text>
							</view>
							<view class="" style="display: flex;">
								<view @tap="value1--" class="" v-if="value1>1">
									<image style="width: 48rpx;height: 48rpx;" src="../../static/o-sub.png" mode=""></image>
								</view>
								<view class="" v-else>
									<image style="width: 48rpx;height: 48rpx;" src="../../static/o-sub-1.png" mode=""></image>
								</view>
								<view class="o-5-font-5">
									<text style="position: relative;top: 8rpx;">{{value1}}</text> 
								</view>
								<view class="">
									<image @tap="value1++" style="width: 48rpx;height: 48rpx;" src="../../static/o-add.png" mode="widthFix"></image>
								</view>
							</view>
							
						</view>
					</view>
				</view>
			</view>
			<view class="o-bg-3"></view>
			
			<view class="content">
				<view class="" style="display: flex;margin-top: 20rpx;">
					
					<view  v-if="isCheck2" class="" style="display: flex;align-items: center;">
						<image @tap="isCheck2=!isCheck2" style="width: 48rpx;height: 48rpx;" src="../../static/check-1.png" mode="widthFix"></image>
					</view>
					
					<view  v-if="!isCheck2" class="" style="display: flex;align-items: center;">
						<image @tap="isCheck2=!isCheck2" style="width: 48rpx;height: 48rpx;" src="../../static/none.png" mode="widthFix"></image>
					</view>
					
					<view class="" style="margin: 0 8rpx;">
						<image style="width: 248rpx;height: 248rpx;" src="../../static/pic.png" mode="widthFix"></image>
					</view>
					<view class="">
						<view class="o-5-font-1">
							外墙保温砌块 
						</view>
						<view class="o-5-font-1">
							规格(LxBxH)：600x200x250 
						</view>
						<view class="o-5-font-1">
							等级:B05A3.5   平面
						</view>
						<view class="">
							<text class="o-5-font-2">3-5天</text>
							<text class="o-5-font-2">40m³起订</text>
							<text class="o-5-font-2">70%定金</text>
						</view>
						<view class="" style="display: flex;justify-content: space-between;margin-top: 60rpx;">
							<view class="">
								<text class="o-5-font-3">¥89.0</text>
								<text class="o-5-font-4">/m³</text>
							</view>
							<view class="" style="display: flex;">
								
								
								<view class=""  v-if="value2>1">
									<image @tap="value2--" style="width: 48rpx;height: 48rpx;" src="../../static/o-sub.png" mode=""></image>
								</view>
								<view class="" v-else>
									<image style="width: 48rpx;height: 48rpx;" src="../../static/o-sub-1.png" mode=""></image>
								</view>
								<view class="o-5-font-5">
									<text style="position: relative;top: 8rpx;">{{value2}}</text> 
								</view>
								<view class="">
									<image @tap="value2++" style="width: 48rpx;height: 48rpx;" src="../../static/o-add.png" mode="widthFix"></image>
								</view>
							</view>
							
						</view>
					</view>
				</view>
			</view>
			
			<view  v-if="isSet" class="o-bottom" style="display: flex;justify-content: space-between;">
				
				<view class="" style="display: flex;margin-left: 20rpx;">
					<view  v-if="isCheck3" class="" style="display: flex;align-items: center;">
						<image @tap="isCheck" style="width: 48rpx;height: 48rpx;" src="../../static/check-1.png" mode="widthFix"></image>
					</view>
					
					<view  v-if="!isCheck3" class="" style="display: flex;align-items: center;">
						<image @tap="isCheck" style="width: 48rpx;height: 48rpx;" src="../../static/none.png" mode="widthFix"></image>
					</view>
					<view class="" style="padding-top: 35rpx;display: flex;">
						<view class="o-4-font-4" style="margin-left: 6rpx;margin-right: 20rpx;">
							全选
						</view>
						<text class="o-4-font-8">总计：</text>
						<text class="o-4-font-9">¥267.0</text>
					</view>
				
				</view>
				
				<view class="" style="display: flex;">
					<view>
						<button  type="default" style="width: 160rpx;height: 96rpx;margin-right: 20rpx;">
							<text class="o-4-font-7" style="position: relative;top30rpx;">分享</text>
							
							</button>
					</view>
					<view >
						<button @click="toPay()" class="" type="default" style="background-color: #1B4098; width: 160rpx;height: 96rpx;">
							<text class="o-4-font-6" style="position: relative;top30rpx">立即支付</text>
							</button>
						</view>
					</view>
				</view>
				
			</view>
			
			
				
			
			<view v-if="!isSet" class="o-bottom-l">
				
				<view class="content" style="margin-top: 20rpx;">
					<view class="" style="display: flex;justify-content: space-between;">
						<view class="">
							<view class="">
								<view class="o-l2-font-3">
									交付设置
								</view>
							</view>
							<view class="o-l2-font-4">
								我们将根据您设置的交付时间及顺序发货
							</view>
						</view>
						<view class="o-l2-font-5">
							已选0件商品
						</view>
					</view>
				</view>
				
				<view class="content" style="margin-top: 64rpx;display: flex;justify-content: space-between;">
					<view class="" style="margin-right: 20rpx;">
						<view class="uni-list-cell-db">
						    <picker  class="o-l2-list-box" mode="date" :value="date" :start="startDate" :end="endDate" @change="bindDateChange">
						        <view style="margin-left: 20rpx;" class="o-l2-font-6">{{date}}</view>
								<image style="width: 28rpx;height: 28rpx; position: relative;left: 280rpx;top:-15rpx" src="../../static/next.png" mode=""></image>
						    </picker>
						</view>
							
					</view>
						
					<view class="">
						
						<view class="uni-list">
						    <view class="uni-list-cell">
						       
						        <view class="uni-list-cell-db" >
						            <picker class="o-l2-list-box" @change="bindPickerChange" :value="index" :range="array">
						                <view class="o-l2-font-6" style="margin-left: 20rpx;" >{{array[index]}}</view>
										<image style="width: 28rpx;height: 28rpx; position: relative;left: 280rpx;top:-15rpx" src="../../static/next.png" mode=""></image>
						            </picker>
						        </view>
							</view>
						</view>
							
					</view>
					
				</view>
				
				<view @tap="toOrderLiat2" class="o-l2-list-box-2" style="margin-top: 20rpx;">
					<text style="position: relative;top:40rpx">确认设置</text>
				</view>
			</view>	
				
				
				
				
		</view>
		
		
		
	</view>
</template>

<script>
	export default {
		data() {
			const currentDate = this.getDate({
			            format: true
			        })
			return {
				value1:1,
				value2:3,
				isCheck1:false,
				isCheck2:true,
				isCheck3:false,
				isSet:true,
				date: '选择交付日期',
				date2: '交付顺序',
				array: ['交付顺序','第一批交付', '第二批交付', '第三批交付', '第四批交付'],
				index:0
			}
		},
		computed: {
		        startDate() {
		            return this.getDate('start');
		        },
		        endDate() {
		            return this.getDate('end');
		        }
		    },
		watch:{
			isCheck:function(){
				if(isCheck1&&isCheck2){isCheck3=true;}
			}
		},
		methods: {
			toPay:function(){
				uni.navigateTo({
					url:'../order-1/order-1'
				})
			},
			bindPickerChange: function(e) {
			console.log('picker发送选择改变，携带值为', e.target.value)
			this.index = e.target.value
			},
			bindDateChange: function(e) {
			            this.date = e.target.value
			        },
			        bindTimeChange: function(e) {
			            this.time = e.target.value
			        },
			        getDate(type) {
			            const date = new Date();
			            let year = date.getFullYear();
			            let month = date.getMonth() + 1;
			            let day = date.getDate();
			
			            if (type === 'start') {
			                year = year - 60;
			            } else if (type === 'end') {
			                year = year + 2;
			            }
			            month = month > 9 ? month : '0' + month;;
			            day = day > 9 ? day : '0' + day;
			            return `${year}-${month}-${day}`;
			        },
			toOrderLiat2:function(){
				uni.navigateTo({
					url:'../order-list-2/order-list-2'
				})
			},
			toBack:function(){
				console.log(1)
				uni.navigateBack({
					delta: 1 //返回上一级页面
				})
			},
			isCheck:function(){
				this.isCheck3 = !this.isCheck3;
				if(this.isCheck3){
					this.isCheck1=true;
					this.isCheck2=true;
				}else{
					this.isCheck1=false;
					this.isCheck2=false;
				}
			}
		}
	}
</script>

<style lang="less" scoped>
@import url('../../style.less');
@import url('../order-list-2/order-list-2.less');
@import url('order-5.less');

</style>
